﻿namespace KnownCMS.Admin;

/// <summary>
/// KnownCMS管理端配置类。
/// </summary>
public static class AppAdmin
{
    /// <summary>
    /// 添加KnownCMS管理端应用。
    /// </summary>
    /// <param name="services">依赖注入服务。</param>
    public static void AddKnownCMSAdmin(this IServiceCollection services)
    {
        //Stopwatcher.Enabled = true;
        var assembly = typeof(AppAdmin).Assembly;
        services.AddKnownCMS(option => option.IsSite = false);
        services.AddKnownAdmin();
        services.AddKnownAdminCore(option =>
        {
            option.AddModules(ModuleHelper.AddAppModules);
            //option.AddAssembly(assembly);
        });

        services.AddScoped<ICommonService, CommonService>();
        services.AddScoped<IPostService, PostService>();

        //添加模块
        Config.AddModule(assembly);
    }
}